namespace GomuLibrary
{
    using System;

    internal static class BytesHelper
    {
        public static bool CompareBytesArray(byte[] a, byte[] b)
        {
            if (a == null)
            {
                return false;
            }
            if (b == null)
            {
                return false;
            }
            if (a.Length != b.Length)
            {
                return false;
            }
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != b[i])
                {
                    return false;
                }
            }
            return true;
        }

        public static byte[] CopyRange(byte[] source, int srcOffset, int length)
        {
            byte[] dst = new byte[length];
            if (source.Length < length)
            {
                return null;
            }
            Buffer.BlockCopy(source, srcOffset, dst, 0, dst.Length);
            return dst;
        }
    }
}

